import { mutableHandlers, readonlyHandlers } from './baseHandler'
import { track, trigger } from './effect'

export function reactive(raw): any {
  return createActiveObject(raw, mutableHandlers)
}

/**
 * @description:readonly 只读的proxy
 * @param {*} raw
 * @return {*}
 */
export function readonly(raw) {
  return createActiveObject(raw, readonlyHandlers)
}

/**
 * @description: 返回proxy的公共函数
 * @param {*} raw
 * @param {*} baseHandlers
 * @return {*}
 */
function createActiveObject(raw, baseHandlers) {
  return new Proxy(raw, baseHandlers)
}
